import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.SpringLayout;


public class TestDialog {

	static JFrame frame;
	static JPanel panel1, panel2;
	static JButton button1, button2;

	public static void createAndShowGUI() {
		frame = new JFrame("Primary Activity");
		frame.setLayout(new SpringLayout());
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setUndecorated(true);
		frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

		panel1 = new JPanel(true);
		button1 = new JButton("Go to Panel 2");
		button1.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				// Go to Panel 2
				panel1.setVisible(false);
				panel2.setVisible(true);
			}
		});
		panel1.add(new WelcomeScreen(button1));
		frame.add(panel1);

		panel2 = new JPanel(true);
		button2 = new JButton("Go to Panel 1");
		button2.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				// Go to Panel 1
				panel2.setVisible(false);
				panel1.setVisible(true);
			}
		});
		panel2.add(new WelcomeScreen(button2));
		frame.add(panel2);

		frame.setVisible(true);
	}

	public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
            	createAndShowGUI();
            }
        });
    }
}
